<template>
  <div >

    <!-- 布局 ：居中 -->
    <!-- <van-row>
  <van-col span="8"></van-col>
  <van-col span="8">    头像 -->
    <van-image round show-error
      width="80"
      height="80"
    :src="user.userIcon"/>

  <!-- 名字 -->

  <div v-if="la">
    <p>用户:<label>{{user.userName}}</label></p> 
    <p>账号:<label>{{user.userNumber}}</label></p>
    <p>电话:<label>{{user.userPhone}}</label></p>
    <p>邮箱:<label>{{user.userEmail}}</label></p>

  </div>
  <router-link to="/UpdateInfo">修改个人信息</router-link>
<br>
  <router-link to="/updatePassword">修改密码</router-link>
 
  <!-- </van-col>
  <van-col span="8"></van-col>
</van-row> -->


</div>
</template>

<script>
import UserAPI  from '@/api/UserAPI';

export default {
 name: 'MyInfo',
 created(){
  
 },
 mounted() {
  // var getuserId=localStorage.getItem('userId')
  // console.log(getuserId);
  //  this.getMyInfo(getuserId)
   this.getMyInfo()
 },
 data() {
  return {
    user: {
      userId:'',
      userNumber: '',
      userName: '游客',
      userIcon: '',
      userPassword: '',
      userPhone: '',
      userEmail: '',

    },
    la: false,
  }
 },
 methods: {
  getMyInfo(){
    var result = UserAPI.MyAllInfo()
      // 获取响应结果 
      result.then((val)=>{
        console.log(val)
        if(val.success){
          console.log(val)
          this.user.userNumber =val.data.userNumber
          this.user.userId=val.data.userId
          this.user.userName=val.data.userName
          this.user.userIcon=val.data.userIcon
          this.user.userPhone=val.data.userPhone
          this.user.userEmail=val.data.userEmail
          this.la=true
          console.log(this.userDTO.userIcon);
        }else{
          console.log(val.errorMsg)
          alert(val.errorMsg)
      
        }
            })
  },
 }
}
</script>

<style scoped>
p {
color: rgb(41, 41, 43);
}
label{
  color: rgba(16, 142, 201, 0.719);
}
</style>